<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePatentFeesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('patent_fees', function (Blueprint $table) {
            $table->id();
            $table->string('patent_sn',20)->comment('专利号');
            $table->integer('user_id')->default(0)->comment('用户ID');
            $table->string('name')->comment('缴费名称');
            $table->decimal('amount')->comment('缴费金额');
            $table->date('last_time')->nullable()->comment('缴费截止日');
            $table->string('payer')->nullable()->comment('缴费人');
            $table->date('pay_time')->nullable()->comment('缴费日期');
            $table->string('bill_code')->nullable()->comment('票据代码');
            $table->string('bill_number')->nullable()->comment('票据号码,收据号');
            $table->tinyInteger('state')->default(0)->comment('缴费状态');

            $table->timestamps();

            $table->index('user_id');
            $table->index('patent_sn');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('patent_fees');
    }
}
